<!--h5批量上传-->
<script type="text/javascript" src="__STATIC__/Zz22zzUI/localResizeIMG4/lrz.bundle.js"></script>
<script type="text/javascript">
//上传
$('.J_h5upload_weui_patch').on("change",'input',function(){
	var parent = $(this).parent().parent();
	var maxnum = parent.data('maxnum');
	var ulBox = parent.find('ul');

	if (ulBox.children().length >= maxnum) {
		layer.msg('上传图片不能超过'+maxnum+'张');
		return;
	};

	for(var i=0, l=this.files.length; i<l; i++){
		lrz(this.files[0], {width: 480, quality:0.9})
			.then(function (rst) {
				console.log(rst);
				var file = rst.origin;

				var html = '<li class="weui-uploader__file weui-uploader__file_status" style="background-image:url('+rst.base64+')">';
				html += '<input type="hidden" name="fileName[]" value="'+file.name+'">';
				html += '<input type="hidden" name="fileType[]" value="'+file.type+'">';
				html += '<input type="hidden" name="fileSize[]" value="'+file.size+'">';
				html += '<input type="hidden" name="fileData[]" value="'+rst.base64+'">';
				html += '<div class="weui-uploader__file-content J_remove"><i class="weui-icon-warn iconfont icon-shanchu"></i></div></li>';

				ulBox.append(html);
			})
			.catch(function (err) {
				// 处理失败会执行
				console.log(err);
			})
			.always(function () {
				// 不管是成功失败，都会执行
			});
	}
});
//删除
$('.J_h5upload_weui_patch').on("click",'.J_remove',function(){
	var liBox = $(this).parent();
	liBox.remove();
});
</script>
<!--h5批量上传 END-->